{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "colab": {
      "provenance": []
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    },
    "language_info": {
      "name": "python"
    }
  },
  "cells": [
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "BOOCfMynug0A"
      },
      "outputs": [],
      "source": [
        "from audiocraft.models import musicgen\n",
        "import torch\n",
        "\n",
        "model = musicgen.MusicGen.get_pretrained(\"medium\", device=\"cuda\")\n",
        "model.set_generation_params(duration=8)\n"
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "generated_music = model.generate(\n",
        "    [\"80s rock music with drums and electric guitar\", \"90s retro action game music\"],\n",
        "    progress=True,\n",
        ")\n"
      ],
      "metadata": {
        "id": "agewjxRouorh"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "from audiocraft.utils.notebook import display_audio\n",
        "\n",
        "display_audio(generated_music, 32000)\n"
      ],
      "metadata": {
        "id": "P8eYwOqNusyu"
      },
      "execution_count": null,
      "outputs": []
    }
  ]
}